package com.aptech.oas.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;

public class FilesDownloadAction extends ActionSupport {

	private List<String> fileName=new ArrayList<String>();

	public InputStream getDownloadFile() throws FileNotFoundException {
		File file1 = new File("g:/attachment/test1/dos命令操作.docx");
		File file2 = new File("g:/attachment/test1/beans.xml");
		File file3 = new File("g:/attachment/test1/2 IOC.docx");
		File file= new File("g:/attachment/test1");
		String[] fileList=file.list();
		File[] files=file.listFiles();
		try {
			String file1Name=new String("dos命令操作.docx".getBytes("gbk"),"ISO8859-1");
			String file2Name=new String("beans.xml".getBytes("gbk"),"ISO8859-1");
			String file3Name=new String("2 IOC.docx".getBytes("gbk"),"ISO8859-1");
			fileName.add(file1Name);
			fileName.add(file2Name);
			fileName.add(file3Name);
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		InputStream is = new FileInputStream(file1);
		return is;
	}

	@Override
	public String execute() throws Exception {
		return SUCCESS;
	}

	public List<String> getFileName() {
		return fileName;
	}

	public void setFileName(List<String> fileName) {
		this.fileName = fileName;
	}
}
